home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / apidev / ndr3.exe / VERNETX.C < prev    next >
C/C++ Source or Header  |  1993-11-04  |  2KB  |  65 lines

  1. /*
  2.    VERNETX.C  shows how to obtain the NETX version number
  3.               directly.  This is a documented call, though
  4.               the EMSNETX/XMSNETX flag is not widely known.
  5.  
  6.    Author:  Tim Farley
  7.    Copyright 1993, Tim Farley, All Rights Reserved
  8. */
  9.  
  10. #include <stdlib.h>  /* for NULL */
  11.  
  12. #ifdef __TURBOC__
  13.    #define ASM asm
  14. #else
  15.    /* assume Microsoft C if not Turbo/Borland C */
  16.    #define ASM _asm
  17. #endif
  18.  
  19.  
  20. /*
  21.    GetNetWareShellVersion  is similar to the function of the same
  22.                            name from the old C Interface for DOS
  23.                            libraries.
  24.  
  25.    Two differences:  (1) it returns the version number directly
  26.       as the function return value, to act like the other
  27.       functions in this program.  (2) it also returns an
  28.       additional parameter, shellType, which indicates if it
  29.       EMSNETX or XMSNETX are present.
  30. */
  31. int GetNetWareShellVersion( int * revLevel, int * shellType )
  32. {
  33.    char buffer[ 40 ];
  34.    int netxVer, netxRev, netxType;
  35.  
  36.    ASM {
  37.       push  di             /* save C's registers */
  38.       push  si
  39.       mov   ax,ss
  40.       mov   es,ax
  41.       lea   di,buffer      /* ES:DI -> buffer */
  42.       xor   bx,bx
  43.       mov   cx,bx
  44.       mov   ax,0EA01h      /* Func EA01: Get Shell Version Info */
  45.       int   21h
  46.       mov   netxVer,bx     /* store return values */
  47.       mov   al,cl
  48.       xor   ah,ah
  49.       mov   netxRev,ax
  50.       mov   al,ch
  51.       mov   netxType,ax
  52.       pop   si             /* restore C's registers */
  53.       pop   di
  54.    }
  55.  
  56.    if  ( netxVer ) {
  57.       *revLevel  = netxRev;
  58.       *shellType = netxType;
  59.    }
  60.  
  61.    return ( netxVer );
  62. }  /* GetNetWareShellVersion() */
  63.  
  64.  
  65. /* eof: VERNETX.C */